<template>
  <div>
    <!-- 文件展示 -->
    <div
      v-if="
        urlType.type == 'jpg' || urlType.type == 'jpeg' || urlType.type == 'png'
      "
    >
      <a-image :src="urlType.url" :height="imgHeight" />
    </div>
    <div v-else-if="urlType.type">
      <a :href="urlType.url" target="_blank">点击查看</a>
    </div>
    <div></div>
  </div>
</template>
<script lang="ts" setup>
import {ref, computed} from "vue";
const props = defineProps({
  data: {
    type: String,
    default: ""
  },
  height: {
    type: Number,
    default: 100
  }
});
const urlType = computed({
  get() {
    if (props.data) {
      let list = props.data.split(".");
      let type = list[list.length - 1];
      return {url: props.data, type: type};
    } else {
      return {};
    }
  },
  set(value) {}
});
const imgHeight = computed({
  get() {
    return props.height;
  },
  set(value) {}
});
</script>
<style lang="less" scoped></style>
